package com.mx.fs;

import java.io.Serializable;

public abstract class MetaItem implements Serializable{
	
	public static final String NAME_ATTRIBUTE = "name";
	public static final String OWNER_ATTRIBUTE = "owner";
	public static final String FOLDER_ATTRIBUTE = "folder";

	protected String attribute;
	protected String value;

	//The size this item will occupy when transferring in channel
	protected int blockSize; 
	
	public MetaItem(){
		this.attribute = getAttribute();
		this.value = "";
		this.blockSize = getBlockSize();;
	}
	
	public MetaItem(String value) {
		this();
		this.value = value;
		if (value.length() > blockSize){
			this.blockSize = value.length();
		}
	}
	
	public MetaItem(String value, int blockSize){
		this(value);
		this.blockSize = blockSize;
		if (value.length() > blockSize){
			this.blockSize = value.length();
		}
	}
	
	public abstract String getAttribute();
	
	public abstract int getBlockSize();

	public void setAttribute(String attribute) {
		this.attribute = attribute;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public void setBlockSize(int blockSize) {
		this.blockSize = blockSize;
	}
	
	public String toString(){
		return "attribute:" + attribute + "    " + "value:" + value;
	}
}
